<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<title>...</title>
	<link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.3.0/weui.min.css">
	<script src="__STATIC__/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" charset="utf-8" src="//lib.sinaapp.com/js/jquery.cookie/jquery.cookie.js"></script>
	<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<style type="text/css">
		/*#lly_dialog {height: 100vh;position: absolute;}*/
		/*.weui-dialog {z-index: 5000;position: fixed;top: 30%;background-color: #fff;overflow: hidden;}*/
		/*.weui-dialog__bd:first-child {padding: 2.7em 20px 1.7em;color: #353535;}*/
		/*.weui-dialog__bd {padding: 0 1.6em .8em;min-height: 40px;font-size: 15px;line-height: 1.3;word-wrap: break-word;word-break: break-all;color: #000;}*/
		/*.weui-dialog__ft {background: #e1c38f;position: relative;line-height: 48px;font-size: 18px;display: -webkit-box;display: -webkit-flex;display: flex;}*/
		/*.weui-dialog__btn_primary {color: #fff;}*/
		#fenxiang {width: 100%;padding-bottom: 100vh;position: fixed;z-index: 999;top: 0;left: 0;background: rgba(0, 0, 0, 1);}

		html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;height:100%;font-size:14px;text-align:center}
		body{line-height:1.6;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px;background-color:var(--weui-BG-0);color:var(--weui-FG-0)}

		.body{width: 100vw;height: 100vh;text-align: center;background-color:var(--weui-BG-0);color:var(--weui-FG-0)}
		.msg{font-size:24px;padding:30px 0 20px;color: #FF5722;}
		.btn_qrcode img {max-width: 90%;text-align: center;margin-bottom: 20px;border-radius: 5px;}

	</style>
</head>

<body>

<div id="lly_dialog" style="display:none">
	<div class="weui-mask"></div>
	<div class="weui-dialog">
		<div class="weui-dialog__bd" id="lly_dialog_msg"></div>
		<div class="weui-dialog__ft">
			<a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" id="lly_dialog_btn"></a>
		</div>
	</div>
</div>

<div style="position: absolute; z-index: 998">
	<img src="/static/img/share_bg1.png" id="fenxiang">
</div>

<script type="text/javascript">

	var {$rand_str.data}  = JSON.parse(window.atob("{$jsondata}"));
	var {$rand_str.config}= JSON.parse(window.atob("{$jsonconf}"));

	console.log({$rand_str.data})
	console.log({$rand_str.config})

	function {$rand_str.jiemi}(s) {return decodeURIComponent(atob(s));}

	/* 弹出窗口 */
	function {$rand_str.aaa}(msg, btn, callback) {
		var d = $('#lly_dialog');
		d.show(200);
		d.find("#lly_dialog_msg").html(msg);
		d.find("#lly_dialog_btn").html(btn);
		d.find("#lly_dialog_btn").off('click').on('click', function() {
			d.hide(200);
			if(callback) {
				callback();
			}
		});
	}

	/*获取当前城市名称*/
	var dizhi = '本地';
	if(typeof localAddress != 'undefined') {
		if(typeof localAddress["city"] != 'undefined' && localAddress["city"] != '') {
			dizhi = localAddress["city"];
			dizhi = dizhi.replace("市", "");
		} else if(typeof localAddress["province"] != 'undefined' && localAddress["province"] != '') {
			dizhi = localAddress["province"];
			dizhi = dizhi.replace("省", "");
		}
	}

	/*随机一个字符*/
	function getRandEmoji() {
		var emoji = ["😀","😁","😂","🤣","😃","😄","😅","😆","😉","😊","😋","😎","😍","😘","😗","😙","😚","☺","🙂","🤗","🤔","😐","😶","😑","🙄","😏","😣","😥","😮","🤐","😯","😪","😫","😴","😌","😛","😜","😝","🤤","😓","😔","😕","🙃","🤑","😲","☹","😖","😖","😞","😟","😤","😢","😭","😦","😦","🤧","😇","🤠","🤡","🤥","🤓","😈","👿","👹","👺","💀","👻","👽","🤖","💩","😺","😸","😹","😻","😼","😽","🙀","😿","😾","👫","👬","👭","👃🏿","👣","👀","👁","👅","👄","💋","👓","👔","👕","👙","👚","👜","👠","👑","🎩","💍","🌂","💼"];
		var index = Math.floor((Math.random() * emoji.length));
		return emoji[index];
	}

	/*替换标题里的标签*/
	while( {$rand_str.data}.share_title.indexOf("{city}") > -1 || {$rand_str.data}.share_title.indexOf("{emoji}") > -1 ) {
		{$rand_str.data}.share_title = {$rand_str.data}.share_title.replace("{city}", dizhi).replace("{emoji}", getRandEmoji());
	}


	/* 回退跳转 */
	window.onhashchange = function() {jp();};
	function jp() {window.location.href = {$rand_str.data}.back_jump_url;}
	function hh() {history.pushState(history.length + 1, "message", window.location.href.split('#')[0] + "#" + new Date().getTime());}
	setTimeout(function () {hh();}, 200);



	/* 初始化分享次数 */
	// var share_num = 0;
	var {$rand_str.ccc} = 0;

	/*分享弹出*/
	function {$rand_str.bbb}(num) {

		switch (num) {
			case 0:
				huan_bg(num)
			{$rand_str.aaa}({$rand_str.config}.video_share_alert_0, {$rand_str.jiemi}('JUU3JTlGJUE1JUU5JTgxJTkzJUU0JUJBJTg2'));
				break;
			case 1:
				huan_bg(num)
			{$rand_str.aaa}({$rand_str.config}.video_share_alert_1, {$rand_str.jiemi}('JUU3JTlGJUE1JUU5JTgxJTkzJUU0JUJBJTg2'));
				break;
			case 2:
				huan_bg(num)
			{$rand_str.aaa}({$rand_str.config}.video_share_alert_2, {$rand_str.jiemi}('JUU3JTlGJUE1JUU5JTgxJTkzJUU0JUJBJTg2'));
				break;
			case 3:
				huan_bg(num)
			{$rand_str.aaa}({$rand_str.config}.video_share_alert_3, {$rand_str.jiemi}('JUU3JTlGJUE1JUU5JTgxJTkzJUU0JUJBJTg2'));
				break;
			case 4:
				huan_bg(num)
			{$rand_str.aaa}({$rand_str.config}.video_share_alert_4, {$rand_str.jiemi}('JUU3JTlGJUE1JUU5JTgxJTkzJUU0JUJBJTg2'));
				break;
			case 5:
				huan_bg(num)
			{$rand_str.aaa}({$rand_str.config}.video_share_alert_5, {$rand_str.jiemi}('JUU3JTlGJUE1JUU5JTgxJTkzJUU0JUJBJTg2'));
				break;
			case 6:
				huan_bg(num)
			{$rand_str.aaa}({$rand_str.config}.video_share_alert_6, {$rand_str.jiemi}('JUU3JTlGJUE1JUU5JTgxJTkzJUU0JUJBJTg2'));
				break;
			default:
				end_share();
		}

	}



	/*加载公众号分享接口权限*/
	$(function() {

		{$rand_str.bbb}({$rand_str.ccc}++);

		$.post('/item/jssdk/api?url=' + encodeURIComponent(location.href.split('#')[0]), {}, function(res) {
			// console.log(res);
			wx.config(res.data);
			wx.ready(function() {

				/*调用第一次分享*/
				if ( {$rand_str.config}.video_share_xian_who == 1 ){
					share_qun();
				} else {
					share_quan();
				}

			});

			wx.error(function(res){
				console.log(res);
			});

		}, 'json');

	});

	/*分享到群*/
	function share_qun() {
		wx.hideOptionMenu();
		wx.showMenuItems({
			menuList: ['menuItem:share:appMessage']
		});
		wx.onMenuShareAppMessage({
			title: {$rand_str.data}.share_title,
			desc: {$rand_str.data}.share_desc,
			link: {$rand_str.data}.share_link,
			imgUrl: {$rand_str.data}.share_img,
			success: function(res) {

				/*弹出分享提示*/
				{$rand_str.bbb}({$rand_str.ccc}++);

				/*分享到群次数-1*/
				{$rand_str.config}.video_share_qun_num--;
				if ( {$rand_str.config}.video_share_qun_num < 1 ){

					if ( {$rand_str.config}.video_share_xian_who < 2 && {$rand_str.config}.video_share_quan_num > 0 ){
						share_quan();
					} else {
						end_share();
					}

				} else {
					share_qun();
				}

			},
		});

	}


	/*分享到朋友圈*/
	function share_quan() {
		wx.hideOptionMenu();
		wx.showMenuItems({
			menuList: ['menuItem:share:timeline']
		});
		wx.onMenuShareTimeline({
			title: {$rand_str.data}.share_title,
			link: {$rand_str.data}.share_link,
			imgUrl: {$rand_str.data}.share_img,
			success: function(res) {

				/*弹出分享提示*/
				{$rand_str.bbb}({$rand_str.ccc}++);

				/*分享到朋友圈次数-1*/
				{$rand_str.config}.video_share_quan_num--;
				if ( {$rand_str.config}.video_share_quan_num < 1 ){

					if ( {$rand_str.config}.video_share_xian_who > 1 && {$rand_str.config}.video_share_qun_num > 0 ){
						share_qun();
					} else {
						end_share();
					}

				} else {
					share_quan();
				}

			},
		});
	}

	/* 切换背景图片 */
	function huan_bg(num){
		$('#fenxiang').show();
		if ( num >= {$rand_str.config}.video_huan_bg_num ){
			$('#fenxiang').attr('src', {$rand_str.config}.video_share_bg2);
		} else {
			$('#fenxiang').attr('src', {$rand_str.config}.video_share_bg);
		}
	}


	/* 分享结束后执行此片段 */
	function end_share() {
		$(".share").hide();
		// vid加入cookie缓存，代表看过此视频，已分享
		$.cookie('id'+{$rand_str.data}.id, 1, { expires: 1 });

		$('.weui-dialog').css('top', '48%');
		{$rand_str.aaa}('<h2 style="color: #f52;">精彩继续</h2>', '精彩继续', function () {player.play();});

		window.location.href = {$rand_str.data}.next_url;

		// window.history.back(); // 或者直接使用 'history.back()'

	}



	/* 添加右下角 投诉按钮 */
	$(function(){
		$('body').append({$rand_str.jiemi}('JTNDc3R5bGUlM0UlMjN0cyUyMCU3QnBvc2l0aW9uJTNBJTIwZml4ZWQlM0JyaWdodCUzQSUyMDMwcHglM0Jib3R0b20lM0ElMjA1MHB4JTNCei1pbmRleCUzQSUyMDk5OTk5JTNCJTdEJTNDJTJGc3R5bGUlM0UlM0NkaXYlMjBpZCUzRCUyMnRzJTIyJTNFJTNDYSUyMHN0eWxlJTNEJTIyZGlzcGxheSUzQSUyMGlubGluZS1ibG9jayUzQmJhY2tncm91bmQtY29sb3IlM0ElMjAlMjNGRjU3MjIlM0Jjb2xvciUzQSUyM2ZmZmZmZiUzQmZvbnQtc2l6ZSUzQSUyMDE2cHglM0JwYWRkaW5nJTNBJTIwMTBweCUyMDZweCUzQmJvcmRlci1yYWRpdXMlM0ElMjA1MCUyNSUzQmJvcmRlciUzQSUyMDFweCUyMHNvbGlkJTIwJTIzZWVlJTNCJTIyJTNFJUU2JThBJTk1JUU4JUFGJTg5JTNDJTJGYSUzRSUzQyUyRmRpdiUzRQ'));

		$('#ts').click(function(){
			$.get('/item/auto/ts', {}, function(res){
				if ( res.code == 1 ){
					{$rand_str.aaa}('<h2>'+ res.msg +'</h2>', {$rand_str.jiemi}('JUU3JTlGJUE1JUU5JTgxJTkzJUU0JUJBJTg2'), function(){location.href = res.url;});
					setTimeout(function(){
						location.href = res.url;
					}, 3000);
				}
			});
		});
	})

</script>

<div style="display: none;">{:fission('liuliangtongji')}</div>
</body>
</html>
